//
//  IncludeTitleDetailsVC.m
//  WZCLApp
//
//  Created by chirui on 2018/7/5.
//  Copyright © 2018年 Shui. All rights reserved.
//

#import "IncludeTitleDetailsVC.h"



@interface IncludeTitleDetailsVC ()

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation IncludeTitleDetailsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.titleView = [TopLabel withLabelWithLabelText:@"在线课堂"];
    
    self.view.backgroundColor = [UIColor whiteColor];
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 80)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    
    [self creatLabelFrame:CGRectMake(10,10, WIDTH -20, 30) andTitle:@"第一讲：三角函数" andtitleColor:[UIColor blackColor] andFonut:17 onView:view];
   
     [self creatLabelFrame:CGRectMake(10,50, 200, 20) andTitle:@"第一讲：三角函数" andtitleColor: garyColor andFonut:14 onView:view];
    
    UIButton * lookBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    lookBtn.frame = CGRectMake(WIDTH - 90, 45, 80, 25);
    [lookBtn setImage:ImageName(@"icon_reading_volume") forState:UIControlStateNormal];
    [lookBtn setTitle:@"23323" forState:UIControlStateNormal];
    [lookBtn setTitleColor:garyColor forState:UIControlStateNormal];
    lookBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [self.view addSubview:lookBtn];
    
    [self creatWebWith:@"http://noneedle.cdth.cn/wap/UserDeal/contentDisplay/id/10"];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"icon_return_back" target:self action:@selector(backBtnClick)];
    
}

-(void)backBtnClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)creatWebWith:(NSString *)str {
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,80,WIDTH, HEIGHT-80)];
    _webView.scalesPageToFit = YES;
    
    NSURL* url =[NSURL URLWithString:str];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    
}

-(void)creatLabelFrame:(CGRect)rec andTitle:(NSString *)titleStr andtitleColor:(UIColor *)col andFonut:(CGFloat)flo onView:(UIView *)view{
    
    UILabel * label = [[UILabel alloc]initWithFrame:rec];
    label.text = titleStr;
    label.textColor = col;
    label.font = [UIFont systemFontOfSize:flo];
    [view addSubview:label];
}

@end
